
const tool = require('../tools/tool')

module.exports = {
    banner: {
        exp: '轮播图',
        method: 'get',
        async func(data) {
            return await settings.getItem('banner')
        }
    },
    home: {
        exp: '首页',
        method: 'get',
        async func(data) {
            return {
                
            }
        }
    },
    update: {
        exp: '更新设置',
        method: 'post',
        auth: {
            admin: true
        },
        async func(data) {
            await settings.setItem(data.param.key, data.param.value)
        }
    },
    get: {
        exp: '获取设置',
        method: 'get',
        async func(data) {
            let re = await settings.getItem(data.query.key)
            re.price_read = tool.getPriceDisplay(re.price)
            return re
        }
    }
}